
const store = function (Mock) {
    function storeInfo() {

        let storeInfo = Mock.mock({
            'id': '@id',
            'image': '@image("50x50", @color)',
            'background_image': Mock.Random.image('800x200', '@color'),
            'name': '@cword(5, 15)',
            'intro': '@cword(10,20)',
            'time': '@integer(30, 200)',
            'activite_list': Mock.mock({
                'array|1-5': [
                    {
                        'id': '@id',
                        'name': '@cword(4, 6)'
                    }
                ]
            }).array
        })

        return {
            storeInfo,
            'code': 200,
        }
    }

    function getStore() {
        let storeList = Mock.mock({
            "array|10": [
                {
                    "id": "@id",
                    "image": "@image('100x100', @color)",
                    "storeName": '@cword(5,15)',
                    "score": '@float(0, 5, 1, 1)',
                    "monthSales": '@integer(0, 10000)',
                    "perCost": '@integer(0, 100)',
                    "minPrice": '@integer(0, 100)',
                    "shippingPrice": '@integer(0, 50)',
                    "distance": '@integer(0, 10000)',
                    "time": '@integer(0, 120)',
                }
            ]
        }).array

        return {
            storeList,
            code: 200,
        }
    }

    function getStoreByCategory() {
        let storeList = Mock.mock({
            "array|10": [
                {
                    "id": "@id",
                    "image": "@image('100x100', @color)",
                    "storeName": '@cword(5,15)',
                    "score": '@float(0, 5, 1, 1)',
                    "monthSales": '@integer(0, 10000)',
                    "perCost": '@integer(0, 100)',
                    "minPrice": '@integer(0, 100)',
                    "shippingPrice": '@integer(0, 50)',
                    "distance": '@integer(0, 10000)',
                    "time": '@integer(0, 120)',
                    "commodityList": Mock.mock({
                        "array|3": [
                            {
                                "price": '@integer(0, 100)',
                                "discountPrice": '@integer(0, 100)',
                                "image": "@image('100x100', @color)",
                                "name": '@cword(5,15)',
                            }
                        ]
                    }).array
                }
            ]
        }).array

        return {
            storeList,
            code: 200,
        }
    }

    Mock.mock(/\/store\/storeInfo.*?/, 'get', storeInfo)
    Mock.mock(/\/store\/getStoreByCategory.*?/, 'get', getStoreByCategory)
    Mock.mock(/\/store\/getStore.*?/, 'get', getStore)

}

export default store